<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
	<title>Dot Expander Processor | ElasticSearch 7.7 权威指南中文版</title>
	<meta name="keywords" content="ElasticSearch 权威指南中文版, elasticsearch 7, es7, 实时数据分析，实时数据检索" />
    <meta name="description" content="ElasticSearch 权威指南中文版, elasticsearch 7, es7, 实时数据分析，实时数据检索" />
    <!-- Give IE8 a fighting chance -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
	<link rel="stylesheet" type="text/css" href="../static/styles.css" />
	<script>
	var _link = 'dot-expand-processor.html';
    </script>
</head>
<body>
<div class="main-container">
    <section id="content">
        <div class="content-wrapper">
            <section id="guide" lang="zh_cn">
                <div class="container">
                    <div class="row">
                        <div class="col-xs-12 col-sm-8 col-md-8 guide-section">
                            <div style="color:gray; word-break: break-all; font-size:12px;">原英文版地址: <a href="https://www.elastic.co/guide/en/elasticsearch/reference/7.7/dot-expand-processor.html" rel="nofollow" target="_blank">https://www.elastic.co/guide/en/elasticsearch/reference/7.7/dot-expand-processor.html</a>, 原文档版权归 www.elastic.co 所有<br/>本地英文版地址: <a href="../en/dot-expand-processor.html" rel="nofollow" target="_blank">../en/dot-expand-processor.html</a></div>
                        <!-- start body -->
                  <div class="page_header">
<strong>重要</strong>: 此版本不会发布额外的bug修复或文档更新。最新信息请参考 <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html" rel="nofollow">当前版本文档</a>。
</div>
<div id="content">
<div class="breadcrumbs">
<span class="breadcrumb-link"><a href="index.html">Elasticsearch Guide [7.7]</a></span>
»
<span class="breadcrumb-link"><a href="ingest.html">Ingest node</a></span>
»
<span class="breadcrumb-link"><a href="ingest-processors.html">Processors</a></span>
»
<span class="breadcrumb-node">Dot Expander Processor</span>
</div>
<div class="navheader">
<span class="prev">
<a href="dissect-processor.html">« Dissect Processor</a>
</span>
<span class="next">
<a href="drop-processor.html">Drop Processor »</a>
</span>
</div>
<div class="section">
<div class="titlepage"><div><div>
<h2 class="title">
<a id="dot-expand-processor"></a>Dot Expander Processor<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/ingest/processors/dot-expand.asciidoc">edit</a>
</h2>
</div></div></div>
<p>Expands a field with dots into an object field. This processor allows fields
with dots in the name to be accessible by other processors in the pipeline.
Otherwise these <a class="xref" href="accessing-data-in-pipelines.html" title="Accessing Data in Pipelines">fields</a> can’t be accessed by any processor.</p>
<div class="table">
<a id="dot-expander-options"></a>
<p class="title"><strong>Table 42. Dot Expand Options</strong></p>
<div class="table-contents">
<table border="1" cellpadding="4px" summary="Dot Expand Options">
<colgroup>
<col class="col_1">
<col class="col_2">
<col class="col_3">
<col class="col_4">
</colgroup>
<thead>
<tr>
<th align="left" valign="top">Name</th>
<th align="left" valign="top">Required</th>
<th align="left" valign="top">Default</th>
<th align="left" valign="top">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left" valign="top"><p><code class="literal">field</code></p></td>
<td align="left" valign="top"><p>yes</p></td>
<td align="left" valign="top"><p>-</p></td>
<td align="left" valign="top"><p>The field to expand into an object field</p></td>
</tr>
<tr>
<td align="left" valign="top"><p><code class="literal">path</code></p></td>
<td align="left" valign="top"><p>no</p></td>
<td align="left" valign="top"><p>-</p></td>
<td align="left" valign="top"><p>The field that contains the field to expand. Only required if the field to expand is part another object field, because the <code class="literal">field</code> option can only understand leaf fields.</p></td>
</tr>
<tr>
<td align="left" valign="top"><p><code class="literal">if</code></p></td>
<td align="left" valign="top"><p>no</p></td>
<td align="left" valign="top"><p>-</p></td>
<td align="left" valign="top"><p>Conditionally execute this processor.</p></td>
</tr>
<tr>
<td align="left" valign="top"><p><code class="literal">on_failure</code></p></td>
<td align="left" valign="top"><p>no</p></td>
<td align="left" valign="top"><p>-</p></td>
<td align="left" valign="top"><p>Handle failures for this processor. See <a class="xref" href="handling-failure-in-pipelines.html" title="Handling Failures in Pipelines"><em>Handling Failures in Pipelines</em></a>.</p></td>
</tr>
<tr>
<td align="left" valign="top"><p><code class="literal">ignore_failure</code></p></td>
<td align="left" valign="top"><p>no</p></td>
<td align="left" valign="top"><p><code class="literal">false</code></p></td>
<td align="left" valign="top"><p>Ignore failures for this processor. See <a class="xref" href="handling-failure-in-pipelines.html" title="Handling Failures in Pipelines"><em>Handling Failures in Pipelines</em></a>.</p></td>
</tr>
<tr>
<td align="left" valign="top"><p><code class="literal">tag</code></p></td>
<td align="left" valign="top"><p>no</p></td>
<td align="left" valign="top"><p>-</p></td>
<td align="left" valign="top"><p>An identifier for this processor. Useful for debugging and metrics.</p></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="pre_wrapper lang-js">
<pre class="programlisting prettyprint lang-js">{
  "dot_expander": {
    "field": "foo.bar"
  }
}</pre>
</div>
<p>For example the dot expand processor would turn this document:</p>
<div class="pre_wrapper lang-js">
<pre class="programlisting prettyprint lang-js">{
  "foo.bar" : "value"
}</pre>
</div>
<p>into:</p>
<div class="pre_wrapper lang-js">
<pre class="programlisting prettyprint lang-js">{
  "foo" : {
    "bar" : "value"
  }
}</pre>
</div>
<p>If there is already a <code class="literal">bar</code> field nested under <code class="literal">foo</code> then
this processor merges the <code class="literal">foo.bar</code> field into it. If the field is
a scalar value then it will turn that field into an array field.</p>
<p>For example, the following document:</p>
<div class="pre_wrapper lang-js">
<pre class="programlisting prettyprint lang-js">{
  "foo.bar" : "value2",
  "foo" : {
    "bar" : "value1"
  }
}</pre>
</div>
<p>is transformed by the <code class="literal">dot_expander</code> processor into:</p>
<div class="pre_wrapper lang-js">
<pre class="programlisting prettyprint lang-js">{
  "foo" : {
    "bar" : ["value1", "value2"]
  }
}</pre>
</div>
<p>If any field outside of the leaf field conflicts with a pre-existing field of the same name,
then that field needs to be renamed first.</p>
<p>Consider the following document:</p>
<div class="pre_wrapper lang-js">
<pre class="programlisting prettyprint lang-js">{
  "foo": "value1",
  "foo.bar": "value2"
}</pre>
</div>
<p>Then the <code class="literal">foo</code> needs to be renamed first before the <code class="literal">dot_expander</code>
processor is applied. So in order for the <code class="literal">foo.bar</code> field to properly
be expanded into the <code class="literal">bar</code> field under the <code class="literal">foo</code> field the following
pipeline should be used:</p>
<div class="pre_wrapper lang-js">
<pre class="programlisting prettyprint lang-js">{
  "processors" : [
    {
      "rename" : {
        "field" : "foo",
        "target_field" : "foo.bar""
      }
    },
    {
      "dot_expander": {
        "field": "foo.bar"
      }
    }
  ]
}</pre>
</div>
<p>The reason for this is that Ingest doesn’t know how to automatically cast
a scalar field to an object field.</p>
</div>
<div class="navfooter">
<span class="prev">
<a href="dissect-processor.html">« Dissect Processor</a>
</span>
<span class="next">
<a href="drop-processor.html">Drop Processor »</a>
</span>
</div>
</div>

                  <!-- end body -->
                        </div>
                        <div class="col-xs-12 col-sm-4 col-md-4" id="right_col">
                        
                        </div>
                    </div>
                </div>
            </section>
        </div>
    </section>
</div>
<script src="../static/cn.js"></script>
</body>
</html>